from dataclasses import replace
from PyQt5 import QtCore, QtGui, QtWidgets
# from temp.buttonClass import pushButton
from PyQt5.QtWidgets import QMessageBox  
from buttonClass import pushButton,textBrowser,printTest


class Ui_MainWindow(QtWidgets.QMainWindow):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(241, 152)

        # QWidget(MainWindow) 括号里加的是上一层的父容器
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")

        self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget)
        self.verticalLayoutWidget.setGeometry(QtCore.QRect(9, 9, 221, 131))
        self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setObjectName("verticalLayout")

        self.textBrowser = textBrowser()
        self.verticalLayout.addWidget(self.textBrowser)

        # self.pushButton = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.pushButton = pushButton("world")
        self.pushButton.clicked.connect(self.qmaeeageTest)
            

        self.verticalLayout.addWidget(self.pushButton)
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
    
    def qmaeeageTest(self):
        print("hello")
        reply = QMessageBox.information(self,                         #使用infomation信息框  
                                    "标题",  
                                    "出现错误",  
                                    QMessageBox.Yes | QMessageBox.No) 
        print(reply)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        # self.pushButton.setText(_translate("MainWindow", "PushButton"))

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())
